From: Florian Müllner Date: Thu, 30 Nov 2023 13:18:36 +0000 (+0100) Subject: extension-tool: Show "version-name" field if set X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~274 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ca47e7f8e3dd4f4f7de9e4b7b7d16df8f155aeb3;p=gnome-shell.git extension-tool: Show "version-name" field if set Now that both the website and the Extension app support the custom "version-name" field, we should expose it in the CLI tool as well. As a more developer-oriented tool, keep showing the automatic version along-side the new field when both are set. Part-of: --- diff --git a/subprojects/extensions-tool/src/main.c b/subprojects/extensions-tool/src/main.c index 5bf2579b7..327617415 100644 --- a/subprojects/extensions-tool/src/main.c +++ b/subprojects/extensions-tool/src/main.c @@ -229,8 +229,9 @@ void print_extension_info (GVariantDict *info, DisplayFormat format) { - const char *uuid, *name, *desc, *path, *url, *author; + const char *uuid, *name, *desc, *path, *url, *author, *version_name; double state, version; + gboolean has_version, has_version_name; g_variant_dict_lookup (info, "uuid", "&s", &uuid); g_print ("%s\n", uuid); @@ -253,7 +254,14 @@ print_extension_info (GVariantDict *info, if (g_variant_dict_lookup (info, "original-author", "&s", &author)) g_print (" %s: %s\n", _("Original author"), author); - if (g_variant_dict_lookup (info, "version", "d", &version)) + has_version = g_variant_dict_lookup (info, "version", "d", &version); + has_version_name = g_variant_dict_lookup (info, "version-name", "&s", &version_name); + + if (has_version_name && has_version) + g_print (" %s: %s (%.0f)\n", _("Version"), version_name, version); + else if (has_version_name) + g_print (" %s: %s\n", _("Version"), version_name); + else if (has_version) g_print (" %s: %.0f\n", _("Version"), version); g_variant_dict_lookup (info, "state", "d", &state);